package com.followmeandroid.tests;

import android.content.Intent;
import android.test.ActivityUnitTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.widget.Button;

import com.followmeandroid.LoginActivity;
import com.followmeandroid.R;

/**
 * Created by Nicholas on 11/24/2014.
 */
public class LoginActivityTests extends ActivityUnitTestCase<LoginActivity> {

    Intent mLaunchIntent;

    public LoginActivityTests() {
        super(LoginActivity.class);
    }
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        mLaunchIntent = new Intent(getInstrumentation()
                .getTargetContext(), LoginActivity.class);
        startActivity(mLaunchIntent, null, null);
        LoginActivity activity = getActivity();
        //final Button loginButton = (Button)getActivity().findViewById(R.id.btn_Login);
        //final Button registerButton = (Button)getActivity().findViewById(R.id.btn_register);
    }

    @MediumTest
    public void testRegisterWasLaunchedWithIntent(){
        final Button registerButton = (Button)getActivity().findViewById(R.id.btn_register);
        registerButton.performClick();

        final Intent launchIntent = getStartedActivityIntent();
        assertNotNull("Intent was null", launchIntent);
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }
}
